@echo off
chcp 65001 > nul
echo ===============================================
echo 门店管理API测试脚本
echo ===============================================
echo.

set BASE_URL=http://localhost:8080/api
set ADMIN_TOKEN=

echo 1. 测试管理员登录...
curl -X POST %BASE_URL%/admin/login ^
  -H "Content-Type: application/json" ^
  -d "{\"username\": \"admin\", \"password\": \"123456\"}" ^
  -s | jq "."

echo.
echo 请从上面的响应中复制token，然后手动设置ADMIN_TOKEN变量
echo 例如：set ADMIN_TOKEN=your_jwt_token_here
echo.
pause

echo 2. 测试获取门店列表...
curl -X GET "%BASE_URL%/admin/store/list?page=1&size=5" ^
  -H "Authorization: Bearer %ADMIN_TOKEN%" ^
  -s | jq "."

echo.
echo 3. 测试获取门店统计信息...
curl -X GET %BASE_URL%/admin/store/statistics ^
  -H "Authorization: Bearer %ADMIN_TOKEN%" ^
  -s | jq "."

echo.
echo 4. 测试获取营业中的门店...
curl -X GET %BASE_URL%/admin/store/active ^
  -H "Authorization: Bearer %ADMIN_TOKEN%" ^
  -s | jq "."

echo.
echo 5. 测试创建门店...
curl -X POST %BASE_URL%/admin/store/create ^
  -H "Authorization: Bearer %ADMIN_TOKEN%" ^
  -H "Content-Type: application/json" ^
  -d "{\"name\": \"测试门店\", \"code\": \"TEST001\", \"address\": \"测试地址123号\", \"phone\": \"13800138888\", \"businessHours\": \"10:00-22:00\", \"status\": 1, \"description\": \"这是一个测试门店\"}" ^
  -s | jq "."

echo.
echo 6. 测试检查门店编码是否存在...
curl -X GET "%BASE_URL%/admin/store/check-code?code=TEST001" ^
  -H "Authorization: Bearer %ADMIN_TOKEN%" ^
  -s | jq "."

echo.
echo ===============================================
echo 门店管理API测试完成
echo ===============================================
pause 